#include "fan.h"
#include "fanhighcommand.h"
#include "light.h"
#include "lightoffcommand.h"
#include "lightoncommand.h"
#include "macrocommand.h"
#include "remotecontrol.h"
#include "sound.h"

#include <QCoreApplication>
#include <QDebug>

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

    auto light = new Light();
    auto fan = new Fan();
    auto sound = new Sound();

    auto light_on = new LightOnCommand(light);
    auto light_off = new LightOffCommand(light);
    RemoteControl remote1(light_on);
    RemoteControl remote2(light_off);
    remote1.execute();
    remote1.undo();
    remote2.execute();
    remote2.undo();

    remote1.setCommand(light_off);
    remote2.setCommand(light_on);
    remote1.execute();
    remote1.undo();
    remote2.execute();
    remote2.undo();

    qDebug() << "11111111111111111111111111111111111111111111111";
    auto fan_high = new FanHighCommand(fan);
    RemoteControl remote3(fan_high);
    remote3.execute();
    remote3.undo();

    qDebug() << "22222222222222222222222222222222222222222222222";
    auto party = new MacroCommand(QVector<Command *>{light_on, fan_high});
    RemoteControl remote4(party);
    remote4.execute();

    qDebug() << "333333333333333333333333333333333333333333333333333";
    RemoteControl remote5;
    remote5.execute();

    return a.exec();
}
